<template lang="">
    <div>
          <!-- 面包屑导航 -->
            <el-bread></el-bread>
  <!-- 添加按钮 -->
    <el-button type="primary" plain class="add" size="small" @click="addlogin">添加</el-button>

    <!-- 列表的渲染 -->
    <v-list @edit="edit"></v-list>
    <!-- 弹框组件 -->
    <v-dialog ref="digInfo" :isShow = 'isShow' :isAdd = 'isAdd'  @cancel="cancel" ></v-dialog>
    </div>
</template>
<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
    data() {
        return {
            isShow: false,//用于控制弹框的显示隐藏
            isAdd: true,//用于告知弹框是新增还是编辑
        }
    },
    components: {
        vList,
        vDialog
    },
    methods: {
        // 子控制父 去关闭弹窗
        cancel(e) {
            // console.log(e);
            this.isShow = e
        },
        // 点击添加的时候弹框显示
        addlogin() {
            this.isShow = true;
            //告诉弹框你是新增
            this.isAdd = true
        },
        // 封装一个列表自定义事件
        edit(e) {
            // 打开弹窗
            this.isShow = true
            //告诉弹框你是编辑
            this.isAdd = false
            // console.log(e,'eeeee');
            this.$refs.digInfo.lookup(e)
        }
    },
}
</script>

<style lang="less" scoped>
.add {
    margin-top: 20px;
}
</style>